package Control;

import java.util.Date;

import javax.swing.JOptionPane;

import Entity.NeedyResident_ActivateUser;
import Form.NeedyResident_ActivateUser_Form;


public class NeedyResident_ActivateUser_Control {
	
	private NeedyResident_ActivateUser_Form parser;
	
	public NeedyResident_ActivateUser_Form getParser() {
		return parser;
	}

	public void setPaser(NeedyResident_ActivateUser_Form parser) {
		this.parser = parser;
	}

	NeedyResident_ActivateUser resident = new NeedyResident_ActivateUser();
	
	public NeedyResident_ActivateUser_Control(NeedyResident_ActivateUser_Form parser){
		this.setPaser(parser);
		
	}
	
	public NeedyResident_ActivateUser ActivateAccount(){
		resident.setNric(getParser().getTf_nric().getText());
		
		boolean success = resident.ActivateUser();
		
		if (success == true)
			JOptionPane.showMessageDialog(null, "Successful reactivated");
		else
			JOptionPane.showMessageDialog(null, "Reactivation unsuccessful. Please try again");
		
		return resident;
	}
	
	public NeedyResident_ActivateUser getUserInfo(){
		
		//clear previous items
		resident.setNric("null");
		resident.setName("null");
		resident.setEmail("null");
		resident.setContactNo("null");
		NeedyResident_ActivateUser.setPassword("null");
		
		resident.setNric(getParser().getTf_nric().getText());
		
		resident.GetUserInfo();
		
		return resident;
	}

}
